Skip to content

Conversation

@iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Jul 9, 2025

Closes WOOMOB-711

Description

This PR adds the sales channel filter to the order list with 2 options: Point of Sale, and Any. The sales channel filter should work like any other filters in the app, examples:

  • Selecting POS orders should show only POS orders
  • Selecting ANY should show any order
  • POS filter in combination with other filters should show the expected results (ie: with "order status cancelled + POS" = No results if you have none of the sort)
Screen.Recording.2025-07-09.at.14.00.20.mov

Changes

  • Rather than declaring a specific view controller for sales channels, I've used the existing static design introduced on Filter Products screen #2204. This automatically handles simple lists like the one we need here, without having to customize further.
  • Updated OrdersRemote when fetching all orders, as well as OrderAction to pass the created_via property on synchronizeOrders and fetchFilteredOrders. I've discovered too late that core data query is not enough for filtering, while the correct filter was being passed locally, we need to perform a network request when filtering, which should have the &created_via=pos-rest-api param along it.
  • Adjusted the tests to the updated signatures (no new tests have been added yet)

Testing information

  • In a site eligible for POS, and WooCommerce 9.9+, you should see your recent orders marked with a POS badge. If you have none, please go through the POS flow and checkout a few.
  • Navigate to orders tab, tap in Filters, observe the Sales channel filter is now functional.
  • Select "Point of sale" as an option. Observe that POS orders are listed, while others are hidden.
  • Try different filtering combinations.
  • Clear all should clear all filters
  • Filter persistence is not implemented yet, so the sales channel filter won't be saved between runs.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@iamgabrielma iamgabrielma added feature: order list Related to the order list. feature: POS labels Jul 9, 2025
@iamgabrielma iamgabrielma modified the milestones: 22.9, 22.8 Jul 9, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 9, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr15886-21203bc
Version22.7
Bundle IDcom.automattic.alpha.woocommerce
Commit21203bc
Installation URL2r8ksd641ovf8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@iamgabrielma iamgabrielma marked this pull request as ready for review July 9, 2025 09:40
@iamgabrielma iamgabrielma requested a review from joshheald July 9, 2025 10:06
@joshheald joshheald self-assigned this Jul 10, 2025
Copy link
Contributor

@joshheald joshheald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected... consider if we need some tests, but otherwise this can be merged.

Various questions inline, mostly prompted by the PR but out of its scope...

Also – there's a discrepency between salesChannel in the app, and created_via from the API... which is totally fine, this is a better description. Just be as sure as you can that we're safe for any future changes – I could see us adding sales_channel or some other channel in the API, and needing to move to that. After all, couldn't you theoretically create a POS order via the store-api, rather than the rest-api in future?

I think it'll be fine, but just have a think 😊

customer: CustomerFilter(customer: Customer.fake().copy(customerID: 1)),
salesChannel: nil,
numberOfActiveFilters: 4)
salesChannel: .any,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice, any is kind of like a nil filter, right? Should we use POS here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very true, updated on e28ac77 , as well as other existing tests on 21203bc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but a product question; should we add the badge or an option to filter to the LastOrdersDashboardCard? Status is the only filter shown and supported right now, but given badge display and how close the two badges are in the list UI, it may be expected.

For people using the card, I can see clear benefits – e.g. if you use the most recent orders card to check whether you have any unfulfilled orders, POS orders are only ever in the way of you seeing that, because they're always fulfilled. 3 finished POS orders at the top of the list may make you think everything's processed, but be hiding a pending order further down the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very good point, I didn't though about these possibilities until was forced to update the fetching method for other views. I'll check with Sam and raise this for the next milestones.

Comment on lines +259 to +263
case .pointOfSale:
let predicate = NSPredicate(format: "createdVia == %@", "pos-rest-api")
return predicate
case .any:
return nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using it, I immediately felt that there should be a web option.

Other options I've seen in the backend are checkout and rest-api – presumably there are more. checkout came from both the block and classic checkouts, but I did see store_api for a draft order – it got changed to checkout when the order was paid for though.

I don't know how much you've discussed it... even though the fix is out of scope of this PR, it feels wrong from a user perspective right now. Selecting "not POS" would be fine but isn't possible right now, as far as I can see.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it was discussed at the time, but agree: Currently wp-admin already shows a sales channel filter within orders for All Sales Channels, Admin, Checkout, and Point of Sale. So we should do the same in-app

Screenshot 2025-07-14 at 12 17 59

@iamgabrielma iamgabrielma modified the milestones: 22.8, 22.9 Jul 11, 2025
@iamgabrielma
Copy link
Contributor Author

Thanks for the review!

there's a discrepency between salesChannel in the app, and created_via from the API... which is totally fine, this is a better description. Just be as sure as you can that we're safe for any future changes – I could see us adding sales_channel or some other channel in the API, and needing to move to that. After all, couldn't you theoretically create a POS order via the store-api, rather than the rest-api in future?

Yes, I think we could map and centralize these directly in Networking to some sort of SalesChannel enum, or perhaps update the field in the Order model so we parse it directly to closer terms to the ones we use in the app. I assumed that we do not want to touch the actual API, but perhaps that's a good approach as well. I've experimented a bit with it but I was forced to import NetworkingCore into WooCommerce, I'll have to take a better look into it separately. Logged in WOOMOB-848 👍

@iamgabrielma iamgabrielma merged commit 34c8ee4 into trunk Jul 14, 2025
13 checks passed
@iamgabrielma iamgabrielma deleted the task/WOOMOB-711-make-view-for-sales-channel-filter branch July 14, 2025 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: order list Related to the order list. feature: POS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants